<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.sfilyh.util.DBUtil,java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%
 	String sql = "select * from tb_category order by sort";
    request.setAttribute("categoryList", DBUtil.queryForListMap(sql)); 	
 %>
<div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="<%=request.getContextPath()%>">sfilyh的博客</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li <c:if test="${empty cid && empty articleid}">class="active"</c:if>><a href="<%=request.getContextPath()%>/article" >首页</a></li>
              <c:forEach var="item" items="${categoryList}" varStatus="s">
                    <c:choose>				  	
				  	<c:when test="${item.type == 2 }">
					  	<li <c:if test="${articleid == item.articleid}">class="active"</c:if>>
					  		<a href="<%=request.getContextPath()%>/view?id=${item.articleid}" >${item.cname}</a>
					  	</li>	
				  	</c:when>
				  	<c:otherwise>
				  	 <li <c:if test="${cid == item.id}">class="active"</c:if>>
				  	    <a href="<%=request.getContextPath()%>/article?cid=${item.id}" >${item.cname}</a>
				  	 </li>   				  	    
				  	</c:otherwise>
				  	</c:choose>              
              </c:forEach>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
</div>
